﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DXApplicationTangche.UC.登录;
using DXApplicationTangche.UC.下单MTO.Service;

namespace DXApplicationTangche.UC
{
    public partial class Form登录窗口 : DevExpress.XtraEditors.XtraForm
    {
        public String systemUserRight { get; set; }
        public String systemUserRightShop { get; set; }
        public Form登录窗口()
        {
            InitializeComponent();
        }

        private void simpleButton登录_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(this.textBox用户名.Text) || String.IsNullOrWhiteSpace(this.textBox密码.Text))
            {
                MessageBox.Show("用户名密码不能为空");
                return;
            }
            SystemUserMessageRestult systemUserMessageRestult = 登录Service.getSystemUserRight(this.textBox用户名.Text.Trim(), this.textBox密码.Text.Trim());
            if (ConstPlainMessageResult.OK.Equals(systemUserMessageRestult.errorCode))
            {
                this.DialogResult = DialogResult.OK;
                this.systemUserRight = systemUserMessageRestult.errorMessage;
                this.systemUserRightShop = systemUserMessageRestult.userRightShop;
                this.Close();
            }
            else
            {
                MessageBox.Show(systemUserMessageRestult.errorMessage);
                return;
            }
        }

        private void simpleButton重置密码_Click(object sender, EventArgs e)
        {
            new Form重置密码().ShowDialog();
        }
    }
}